﻿using System;
using System.Web.UI;


namespace mojoPortal.Web.RS.SBM
{
    public partial class RSManagePayment : RSBasePage
    {
        int _companyid = 0;
        int _locationid = 0;
        int _paymentid = 0;
        int _invoiceid = 0;

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["locationid"] != null)
                _locationid = Convert.ToInt32(Request.QueryString["locationid"].ToString());
            if (Request.QueryString["paymentid"] != null)
                _paymentid = Convert.ToInt32(Request.QueryString["paymentid"].ToString());
            if (Request.QueryString["invoiceid"] != null)
                _invoiceid = Convert.ToInt32(Request.QueryString["invoiceid"].ToString());

            if (!Page.IsPostBack)
            {
                InitializeReadyServicePage();

                RSUserIdentity userIdentity = GetRSUserIdentity();
                _companyid = userIdentity.RSCompanyId;

                if (_companyid > 0)
                {
                    if (Request.QueryString["action"] == "add")
                        SetRSPageHeader("Add Payment");
                    else
                        SetRSPageHeader("Edit Payment");

                    ucPaymentControl.LoadPaymentData(_companyid, _locationid, _invoiceid, _paymentid);

                }
            }
        }

    }
}